<?php

use Illuminate\Support\Facades\Auth;

/**
 * Created by PhpStorm.
 * User: zhangjungui
 * Date: 2019/9/29
 * Time: 17:34
 */

function help_zjg_test(){
    echo 'help function';
}

if (! function_exists('request')) {
    /**
     * Get an instance of the current request or an input item from the request.
     *
     * @param string $key
     * @param mixed $default
     * @return \Illuminate\Http\Request|string|array
     */
    function request($key = null, $default = null)
    {
        if (is_null($key)) {
            return app('request');
        }

        return app('request')->input($key, $default);
    }
}


if (! function_exists('user_id')) {
    /**
     * 获取用户id
     * @return int
     * @author shaowei
     * @access public user_id
     */
    function user_id()
    {
        return Auth::user()->id;
    }
}


if (! function_exists('openid')) {
    /**
     * 获取用户id
     * @return int
     * @author shaowei
     * @access public user_id
     */
    function openid()
    {
        return Auth::user()->open_id;
    }
}


